﻿#ifndef MISC_H
#define MISC_H

#include <QString>
#include <QObject>
#include <QDebug>
#include "function.h"
#include "cenum.h"


typedef struct
{
    QString username;
    QString password;
    QString phoneNum;
    QString newPassword;

}USER_INFO;

typedef struct
{
    QString p_name;
    quint16 p_age;
    QString p_sex;
    QString p_nation;
    CEnum::PATIENT_BLOOD_TYPE p_bloodtype;
    QString p_birthday;
    QString p_ID;
    QString p_phonenum;
    QString p_diseaseHistory;
    QString p_drugAllergyHistory;

}PATIENT_INFO; //病人信息


typedef struct
{
    QString operation_type;
    quint16 operation_line_count;
    quint16 operation_line_num;

}OPERATION_LINE_INFO; //手术排队信息

typedef struct
{
    QString collect_num;
    QString value;
    QString timestamp;

}PRESSURE_DATA; //腹内压数据


typedef struct
{
    QString name; //排队界面中的name关键字
    int currentLine;
    bool isLine;
    int number;

}MEDICAL_KIND;



class MsgDatagram
{

protected:
    friend QDebug operator <<(QDebug debug,const MsgDatagram &msg)
    {

        debug<<"m_Head:"<<msg.m_Head<<" m_source:"<<msg.m_source<<" password:"<<msg.m_user.password<<" phoneNum:"<<msg.m_user.phoneNum<<" username:"<<msg.m_user.username
             <<" ID:"<<msg.m_patientInfo.p_ID<<" age:"<<msg.m_patientInfo.p_age<<" sex:"<<msg.m_patientInfo.p_sex<<" name:"<<msg.m_patientInfo.p_name
             <<" nation:"<<msg.m_patientInfo.p_nation<<" :"<<msg.m_patientInfo.p_birthday<<" :"<<msg.m_patientInfo.p_phonenum
             <<" bloodtype:"<<msg.m_patientInfo.p_bloodtype<<" :"<<msg.m_patientInfo.p_diseaseHistory<<" :"<<msg.m_patientInfo.p_drugAllergyHistory
             <<" operation_type:"<<msg.m_opeLineInfo.operation_type<<" operation_line_num:"<<msg.m_opeLineInfo.operation_line_num<<" operation_line_count:"<<msg.m_opeLineInfo.operation_line_count
             <<" value:"<<msg.m_pressureData.value<<" timestamp:"<<msg.m_pressureData.timestamp<<" collect_num:"<<msg.m_pressureData.collect_num
             <<" function:"<<msg.function<<" logStatus:"<<msg.m_logStatus<<" errorReason:"<<msg.m_errorReason<<" medicalKindname:"<<msg.m_medicalKind.name<<" isLine:"<<msg.m_medicalKind.isLine
             <<" m_medicalKindnumber:"<<msg.m_medicalKind.number<<" currentLine:"<<msg.m_medicalKind.currentLine<<endl;
        return debug;
    };

public:
    QString           m_Head = "7E7E";  //网路传输报文报头
    CEnum::MSG_SOURCE        m_source;  //数据源（手机/数据采集设备）
    USER_INFO                  m_user;  //手机APP用户信息
    PATIENT_INFO        m_patientInfo;  //病人信息
    OPERATION_LINE_INFO m_opeLineInfo;  //病人排队信息
    PRESSURE_DATA      m_pressureData;  //腹内压数据
    QString                  function;  //程序内部功能函数
    bool                  m_logStatus;  //反馈信息状态
    QString             m_errorReason;  //反馈信息错误原因
    MEDICAL_KIND        m_medicalKind;  //药物种类
    QString                    choose;

    QString                        ip;  //数据源IP
    quint16                      port;  //数据源端口


};

#endif // MISC_H


